package org.nightrunner.d3.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.OrderBy;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;

/**
 * 装备表
 * 
 * @author NightRunner
 * @Date 2012-7-26
 * @version 1.0
 */

@Entity
@Indexed
@Table(name = "d3_equipment", catalog = "d3")
public class Equipment implements java.io.Serializable {

	private static final long serialVersionUID = 4623891446740040393L;

	/**
	 *装备为ID
	 */
	@DocumentId
	private String equipmentId;

	/**
	 *装备名称
	 */
	@Field(index = Index.TOKENIZED, store = Store.YES, name = "equipmentName")
	private String equipmentName;

	@Field(index = Index.TOKENIZED, store = Store.YES, name = "equipmentDescription")
	private String equipmentDescription;

	@Field(index = Index.TOKENIZED, store = Store.YES, name = "equipmentKeywords")
	private String equipmentKeywords;

	/**
	 * CTEs
	 */
	private List<CTE> CTEs;

	/**
	 * 前缀
	 */
	private List<ETP> ETPs;

	@OneToMany(mappedBy = "equipment", targetEntity = ETP.class)
	@OrderBy(clause = "sort ASC")
	public List<ETP> getETPs() {
		return ETPs;
	}

	/**
	 * 收费标准
	 */
	@Field(index = Index.TOKENIZED, store = Store.YES, name = "itemLevel")
	private String equipmentItemLevel;

	public String getEquipmentItemLevel() {
		return equipmentItemLevel;
	}

	@OneToMany(mappedBy = "equipment", targetEntity = CTE.class)
	@OrderBy(clause = "sort ASC")
	public List<CTE> getCTEs() {
		return CTEs;
	}

	@Column(name = "equipment_description", length = 256)
	public String getEquipmentDescription() {
		return equipmentDescription;
	}

	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name = "equipment_id", nullable = false, length = 32)
	public String getEquipmentId() {
		return this.equipmentId;
	}

	@Column(length = 200, name = "equipment_name")
	public String getEquipmentName() {
		return equipmentName;
	}

	@Column(length = 200, name = "equipment_keywords")
	public String getEquipmentKeywords() {
		return equipmentKeywords;
	}

	/** default constructor */
	public Equipment() {
	}

	/** minimal constructor */
	public Equipment(String equipmentId) {
		this.equipmentId = equipmentId;
	}

	public void setEquipmentKeywords(String equipmentKeywords) {
		this.equipmentKeywords = equipmentKeywords;
	}

	public void setEquipmentDescription(String equipmentDescription) {
		this.equipmentDescription = equipmentDescription;
	}

	public void setEquipmentId(String equipmentId) {
		this.equipmentId = equipmentId;
	}

	public void setEquipmentName(String equipmentName) {
		this.equipmentName = equipmentName;
	}

	public void setCTEs(List<CTE> CTEs) {
		this.CTEs = CTEs;
	}

	public void setEquipmentItemLevel(String equipmentItemLevel) {
		this.equipmentItemLevel = equipmentItemLevel;
	}

	public String toString() {
		return equipmentName;
	}

	public void setETPs(List<ETP> eTPs) {
		ETPs = eTPs;
	}
}
